home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
CC_C
/
1116.ZIP
/
TOOLKIT.ARC
/
DECOM.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
4KB
|
96 lines
(*
DOCUMENTATION FOR: DECOM.COM
__________________________________________________________________________
DECOM strips the comment lines out of the assembly language code
file that are written by the CPC Small C compiler (CPC.EXE).
DECOM makes handling of large Small C programs easier, since
the large *.ASM file that CPC.EXE writes contains all of
the Small C syntax as comment lines.
DECOM was written so that CPCX.ASM could be made to fit on a
179 Kbyte-formatted single-sided floppy disk. Before DECOM
the file size of CPCX.ASM was 193.3 Kbytes. After DECOM the
file size of CPCX.ASM was 141.0 Kbytes (11307 ASM code lines).
Unfortunately, this did not shorten the assembly time, using
MASM.
DECOM renames the *.ASM file as *.TMP and tests to see if
the first character of each line is a semicolon. If the
first character is not a semicolon, then the line is
written to a new *.ASM file. The *.TMP file is then erased.
__________________________________________________________________________
*)
PROGRAM DECOM(INPUT,OUTPUT);
TYPE SOURCE_CODE = TEXT;
VAR SOURCE_CODE_IN : SOURCE_CODE;
SOURCE_CODE_OUT : SOURCE_CODE;
LINE_NUMBER : STRING[5];
PROG_NAME_IN : STRING[12];
PROG_NAME_OUT : STRING[12];
PROG_NAME_TMP : STRING[12];
A_LINE_OF_CODE : STRING[70];
L1,L2 : INTEGER;
PROCEDURE INPUT_SCREEN;
BEGIN {INPUT}
CLRSCR; GOTOXY(33,6); WRITELN('PROGRAM DECOM');
GOTOXY(18,8); WRITELN('[to reduce the size of Small C *.ASM files]');
GOTOXY(21,12); WRITELN('ENTER the name of the file to reduce');
GOTOXY(28,14); WRITE('--> '); READLN(PROG_NAME_IN);
{Note: PROG_NAME_IN will already be <= 8 char in length via MS-DOS}
L1 := POS('.',PROG_NAME_IN); {Check for a filename extension}
IF L1 > 0 THEN
BEGIN {IF}
PROG_NAME_OUT := COPY(PROG_NAME_IN,1,L1);
PROG_NAME_TMP := PROG_NAME_OUT + 'TMP';
PROG_NAME_OUT := PROG_NAME_OUT +'ASM';
END {IF}
ELSE
BEGIN {ELSE}
PROG_NAME_TMP := PROG_NAME_IN + '.TMP';
PROG_NAME_OUT := PROG_NAME_IN + '.ASM';
END; {ELSE}
GOTOXY(24,18);
ASSIGN(SOURCE_CODE_IN,PROG_NAME_IN);
RESET(SOURCE_CODE_IN);
READLN(SOURCE_CODE_IN,A_LINE_OF_CODE);
CLOSE(SOURCE_CODE_IN);
END; {INPUT}
PROCEDURE READ_THEN_STRIP_THEN_REWRITE_THE_CODE;
BEGIN {R-S-RW-C}
L2 := 0;
ASSIGN(SOURCE_CODE_IN,PROG_NAME_TMP);
RESET(SOURCE_CODE_IN);
ASSIGN(SOURCE_CODE_OUT,PROG_NAME_OUT);
REWRITE(SOURCE_CODE_OUT);
WHILE NOT EOF(SOURCE_CODE_IN) DO
BEGIN {WHILE}
READLN(SOURCE_CODE_IN,A_LINE_OF_CODE);
IF A_LINE_OF_CODE[1] <> ';' THEN
BEGIN {IF}
WRITELN(SOURCE_CODE_OUT,A_LINE_OF_CODE);
L2 := L2 + 1;
END; {IF}
END; {WHILE}
CLOSE(SOURCE_CODE_IN);
CLOSE(SOURCE_CODE_OUT);
END; {R-S-RW-C}
BEGIN {MAIN}
INPUT_SCREEN;
RENAME(SOURCE_CODE_IN,PROG_NAME_TMP);
READ_THEN_STRIP_THEN_REWRITE_THE_CODE;
GOTOXY(1,22);
WRITELN(' PROCESSING COMPLETE');
WRITELN(' PROGRAM LINE COUNT IS: ',L2);
WRITELN(' ');
ERASE(SOURCE_CODE_IN);
END. {MAIN}